<% content_for :sidebar do -%>
  <h4><%= link_to "看我收到的消息", messages_url %></h4>
  <% if @status == "inbox" && @message.sender_id != 0 -%>
    <h4><%= link_to "去#{@message.sender_name}的主页看看", user_url(@message.sender_id) %></h4>
  <% elsif @status == "outbox" -%>
    <h4><%= link_to "看我发出的消息", outbox_messages_url %></h4>
  <% end -%>
<% end -%>

<h3>
  <% if @status == "inbox" -%>
    我收到的消息
  <% elsif @status == "outbox" -%>
    我发出的消息
  <% end -%>
</h3>
<p><label for="message_title">标题：</label><%= h @message.title %></p>
<p>
  <% if @status == "inbox" -%>
    <label for="message_sender">来自：</label>
    <% if @message.sender_id != 0 -%>
      <%= link_to @message.sender.login, user_url(@message.sender.id) %>
    <% else -%>
      <%= @message.sender_name %>
    <% end -%>
  <% elsif @status == "outbox" -%>
    <label for="message_receiver">发给：</label>
    <% if @message.receiver_id != 0 -%>
      <%= link_to @message.receiver.login, user_url(@message.receiver.id) %>
    <% else -%>
      <%= @message.receiver_name %>
    <% end -%>
  <% end -%>
</p>
<p><label for="message_created_at">时间：</label><%= @message.created_at.to_date %></p>
<p><%= @message.content_html %></p>

<p style="text-align:right">
  <%= link_to "回复", reply_message_url(@message.id) if @message.replyable?(current_user) %>
  <%= link_to "删除", message_url(@message.id), :method => 'delete', :confirm => "确定删除？" %>
</p>